/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.img;

import java.io.File;
import java.io.IOException;

/**
 * <p>Project: app2022 - Ex1
 * <p>Powered by webrx On 2022-01-24 08:27:25
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex1 {
    public static void main(String[] args) throws IOException {
        File f = new File("D:\\");
        for (File t : f.listFiles()) {
            String n = t.getName();
            if (n.length() < 30) {
                // System.out.println(n.getBytes().length);
                n = n.concat(" ".repeat(30 - n.length()));
            }

            String d = String.format("%tF %<tT\t", t.lastModified());
            String ext = t.isDirectory() ? "文件夹" : "文件";
            String ss = "   ";
            if (t.isDirectory()) {
                ss = ss.concat(" ".repeat(17));
            } else {
                ss = ss.concat(String.format("%15d字节", t.length()));
            }
            System.out.println(n + d + ext + ss);
            System.out.println(n.length() + ":" + n.getBytes().length);
        }

    }
}

